﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Admin.ViewModels.DemandConvertPriceViewModels>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<%@ Import Namespace="SDT.Lib.Paging" %>
<%@ Import Namespace="SDT.Admin.Controllers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Quản lý khoảng giá cần mua, cần thuê
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if(ViewData["MessageInfo"]==null){ %>
	<form action="/DemandConvertPrice" method="post" name="adminForm">
		<table width="100%">
			<tr>
			    <td align="left">
			        Tìm nhanh <%= Html.TextBox("Keyword", Model.Keyword) %>
			        <%= Html.ActionImageJS("Tìm kiếm", "icon-32-search.png", "document.adminForm.submit();", false)%>
			    </td>
				<td align="right">
				<%=Html.DropDownList("TypeID", new SelectList(Model.DemandTypes, "ID", "Name", Model.CurrentTypeProduct).ToList(), "-- Loại cần mua/ cần thuê --", new { onchange = "document.adminForm.submit();" })%>
			    </td>
			</tr>
		</table>
		<table width="100%" class="adminlist">
		    <thead>
			<tr>
				<th width="10" align="right">
					STT
				</th>
				<th width="30">
				</th>
				<th width="30">
				</th>
				<th align ="center">
					Khoảng giá
				</th>
				<th align ="center">
					Loại BĐS
				</th>
				<th align ="center">
					Ngày thêm
				</th>
				<th align ="center">
					Người thêm
				</th>
				<th align ="center">
					ID
				</th>
			</tr>
			</thead>
			<tbody>
		<% 
			int i = 0;
    		foreach (var item in Model.ListDemandConvertPrice) {
				i++;
		%>
			<tr>
				<td align="right">
					<%= i.ToString() %>
				</td>
				<td align="center">
					<%= Html.ActionImage("Sửa", "icon-24-edit.png", "DemandConvertPrice", "Edit", new Dictionary<string, object>(){{ "id", item.ID }})%>
				</td>
				 <td align="center">
					<%= Html.ActionImage("Xóa", "icon-24-delete.png", "DemandConvertPrice", "Delete", new Dictionary<string, object>() { { "id", item.ID } })%>
				</td>
				<td align="center">
				  <%=Html.ActionLink(item.Name, "Detail", "DemandConvertPrice", new { @id = item.ID }, "")%>
				</td>
				<td align="center">
				  <%=Html.Encode(item.DemandType.Name)%>
				</td>
				<td align="center">
				<%=Html.Encode(string.Format("{0:dd/MM/yyyy}", item.AddDate))%>
				</td>
				<td align="center">
				<%=Html.Encode(item.NameUserAddBy().UserName) %>
				</td>
				<td align="center">
				<%=Html.Encode(item.ID) %>
				</td>
			</tr>
	    
		<% } %>
        </tbody>
		</table>
		
		<table width="100%">
            <tr>
                <td align="center">
             
                <div class="pager">
                <label>Hiển thị #</label>
                    <%
                        int[] pageSizeList = {1, 5, 10, 15, 20, 25, 50, 100};
                    %>
                    <%= Html.DropDownList("PageSize", new SelectList(pageSizeList, Model.ListDemandConvertPrice.PageSize), new { onchange = "document.adminForm.submit();" })%>

                    <%= Html.Pager(Model.ListDemandConvertPrice.PageSize, Model.ListDemandConvertPrice.PageNumber, Model.ListDemandConvertPrice.TotalItemCount)%>
                </div>
                </td>
            </tr>
        </table>
	</form>
 <% } %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
<%= Html.Toolbar("Thêm mới", "/DemandConvertPrice/Create", "new") %>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
Quản lý khoảng giá cần mua, cần thuê
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
<%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>  
</asp:Content>
